package com.htbb.common.base;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import com.htbb.core.base.IDCreator;
import com.htbb.core.common.ModuleConst;

/**
 * 属性文件配置
 * @author wuyongde
 *
 */
@Component
public class PropertiesConfig {

	// 服务器名称
	public static String serverName;
	// 服务ID
	public static String serverId;
	public static String nfsFile;
	
	public static String merchantCode;

	public static String haiTunKey;

	public static String payAction;
	
	//车险产品id
	public static long CAR_PROD_ID=11120161019135503l;
	public static String CAR_SKU_CODE="CARI";
	public static String CAR_COMPANY_NAME="车险";
	
	public static String busiChnl; 
	public static String prodNo; 
	public static String webServiceUrl;
	public static String signKey;
	
	public static IDCreator iDCreator;

	//渠道代码 "jiankang160"
	@Value("${qh.busiChnl}")
	public void setBusiChnl(String busiChnl) {
		if(!"${qh.busiChnl}".equals(busiChnl)){
			PropertiesConfig.busiChnl = busiChnl;
		}
	}
	
	//产品代码  040015
	@Value("${qh.prodNo}")
	public void setProdNo(String prodNo) {
		if(!"${qh.prodNo}".equals(prodNo)){
			PropertiesConfig.prodNo = prodNo;
		}
	}
	
	//出单地址 
	@Value("${qh.webServiceUrl}")
	public void setWebServiceUrl(String webServiceUrl) {
		if(!"${qh.webServiceUrl}".equals(webServiceUrl)){
			PropertiesConfig.webServiceUrl = webServiceUrl;
		}
	}
	
	@Value("${qh.signKey}")
	public void setSignKey(String signKey) {
		if(!"${qh.signKey}".equals(signKey)){
			PropertiesConfig.signKey = signKey;
		}
	}
	
	
	@Value("${server.name}")
	public void setServerName(String serverName) {
		if(!"${server.name}".equals(serverName)){
			PropertiesConfig.serverName = serverName;
		}
	}
	
	@Value("${nfs_file}")
	public void setNfsFile(String nfsFile) {
		if(!"${nfs_file}".equals(nfsFile)){
			PropertiesConfig.nfsFile = nfsFile;
		}
	}

	@Value("${server.id}")
	public void setServerId(String serverId) {
		if(!"${server.id}".equals(serverId)){
			PropertiesConfig.serverId = serverId;
			PropertiesConfig.iDCreator = new IDCreator(ModuleConst.ORDER_MODULE, Integer.parseInt(serverId));
		}
	}

	@Value("${merchant_code}")
	public void setMerchantCode(String merchantCode) {
		if(!"${merchant_code}".equals(merchantCode)){
			PropertiesConfig.merchantCode = merchantCode;
		}
	}

	@Value("${haiTunKey}")
	public void setHaiTunKey(String haiTunKey) {
		if(!"${haiTunKey}".equals(haiTunKey)){
			PropertiesConfig.haiTunKey = haiTunKey;
		}
	}

	@Value("${pay_action}")
	public void setPay_action(String payAction) {
		if(!"${pay_action}".equals(payAction)){
			PropertiesConfig.payAction = payAction;
		}
	}
	
}
